home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
JCSM Shareware Collection 1993 November
/
JCSM Shareware Collection - 1993-11.iso
/
cl720
/
bxprntjj.lzh
/
TEST2.C
< prev
Wrap
C/C++ Source or Header
|
1990-12-10
|
2KB
|
38 lines
/* !!!!!!!!!!!!!! Type: BOXPRINT/FORMAT(A) TEST2 !!!!!!!!!!!!!!!!!!!!!!*/
/* An integer MandelBrot set Program. *//* Works with EGA and VGA. */
#include <stdio.h>
#include <graph.h>
#define not !
#define forever while (1)
#define MAX_ITERATIONS 30
#define MAX_BOUND 10000
typedef unsigned char uchar;
typedef unsigned int boolean;
typedef uchar * string;
typedef unsigned long ulong;
typedef int coord;typedef long dcoord;typedef struct{coord x,y;}point;
struct videoconfig vc;point ScreenSize,Cursor,Centre,Scale;float RealX,
RealY, Mag;int ScatX[640],ScatY[480];int under[20];char name[12]={"\0"};
char buf[80];long new_colors[16]={0x000000,0x252A26,0x37343F,0x3F3F3F,
0x2E333F,0x00003F,0x00273F,0x00363F,0x003F3F,0x003F26,0x2A3F00,0x3F271B,
0x3F0000,0x3F002B,0x350A35,0x3F003F};void DoPixel(int x,int y);
/* Colour in one pixel. */boolean ClearScreen(void);
/************ Initialisation routines *********************/
void assert(boolean c){if(not c)fprintf(stderr,"Error!\007");}void Swap(int
*a,int*b){register int c;c=*a;*a=*b;*b=c;}void Init(void){int i;if(not
ClearScreen()){printf("Not supported.");exit(0);}_getvideoconfig(&vc);
ScreenSize.x=vc.numxpixels;ScreenSize.y=vc.numypixels;Mag = 1;/* Magnification */
Centre.x=ScreenSize.x/2;/* Centre of screen */
Centre.y=ScreenSize.y/2;ScreenSize.y--;
/* We decrement this to obtain *//* two relatively prime numbers*/
/* for the screen dimensions. */
/*------ Shuffle the Scat ('scatter') array. ------*/for(i=0;i<
ScreenSize.x;i++)ScatX[i]=i;for(i=0;i<ScreenSize.y;i++)ScatY[i]=i;
for(i=0;i<ScreenSize.x;i++)Swap(&ScatX[i],&ScatX[rand()%ScreenSize.x]);
for(i=0;i<ScreenSize.y;i++)Swap(&ScatY[i],&ScatY[rand()%ScreenSize.y]);
Scale.x=ScreenSize.x*Mag/4;Scale.y=ScreenSize.y*Mag/4;}boolean ClearScreen
(void){boolean r;if(not _setvideomode(_VRES16COLOR))/* First try VGA. */
r=_setvideomode(_ERESCOLOR);/* Then try EGA */_remapallpalette(new_colors);
}
/**************** Picture-drawing routines ******************/
void DoPixe╨tr, s